VERSION 5.00
Begin VB.Form frmFiltroStampa 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "Stampa"
   ClientHeight    =   2040
   ClientLeft      =   45
   ClientTop       =   315
   ClientWidth     =   4920
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2040
   ScaleWidth      =   4920
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.Frame Frame1 
      Height          =   1215
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   4695
      Begin VB.ComboBox cboTipoUtente 
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   360
         ItemData        =   "frmFiltroStampa.frx":0000
         Left            =   1800
         List            =   "frmFiltroStampa.frx":0013
         Style           =   2  'Dropdown List
         TabIndex        =   3
         Top             =   240
         Width           =   2775
      End
      Begin VB.PictureBox picData 
         AutoSize        =   -1  'True
         BorderStyle     =   0  'None
         Height          =   360
         Index           =   1
         Left            =   4200
         ScaleHeight     =   360
         ScaleWidth      =   360
         TabIndex        =   2
         ToolTipText     =   "Cerca data"
         Top             =   720
         Width           =   360
      End
      Begin VB.PictureBox picData 
         AutoSize        =   -1  'True
         BorderStyle     =   0  'None
         Height          =   360
         Index           =   0
         Left            =   1920
         ScaleHeight     =   360
         ScaleWidth      =   360
         TabIndex        =   1
         ToolTipText     =   "Cerca data"
         Top             =   720
         Width           =   360
      End
      Begin VB.Label lblData 
         Alignment       =   2  'Center
         BackColor       =   &H80000009&
         BorderStyle     =   1  'Fixed Single
         Caption         =   "Tutte le date"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   0
         Left            =   600
         TabIndex        =   8
         Top             =   765
         Width           =   1215
      End
      Begin VB.Label lblData 
         Alignment       =   2  'Center
         BackColor       =   &H80000009&
         BorderStyle     =   1  'Fixed Single
         Caption         =   "Tutte le date"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   1
         Left            =   2880
         TabIndex        =   7
         Top             =   765
         Width           =   1215
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "Al"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Index           =   5
         Left            =   2520
         TabIndex        =   6
         Top             =   760
         Width           =   225
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "Dal"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Index           =   2
         Left            =   120
         TabIndex        =   5
         Top             =   760
         Width           =   375
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "Tipo utente"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Index           =   0
         Left            =   120
         TabIndex        =   4
         Top             =   270
         Width           =   1185
      End
   End
   Begin VB.Frame Frame2 
      Height          =   855
      Left            =   120
      TabIndex        =   9
      Top             =   1080
      Width           =   4695
      Begin VB.CommandButton cmdStampa 
         Caption         =   "&Stampa"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   1680
         TabIndex        =   11
         Top             =   240
         Width           =   1260
      End
      Begin VB.CommandButton cmdAnnulla 
         Cancel          =   -1  'True
         Caption         =   "&Annulla"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   3240
         TabIndex        =   10
         Top             =   240
         Width           =   1260
      End
   End
End
Attribute VB_Name = "frmFiltroStampa"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Const strTutte As String = "Tutte le date"

Private Sub cmdStampa_Click()
    If Completo Then
        tStampe.utente = cboTipoUtente.ListIndex + 1
        If lblData(0) <> strTutte And lblData(1) <> strTutte Then
            tStampe.dataDal = lblData(0)
            tStampe.dataAl = lblData(1)
            tStampe.tutteLeDate = False
        Else
            tStampe.tutteLeDate = True
        End If
        Unload Me
    End If
End Sub

Private Sub Form_Load()
    Dim i As Integer
    
    For i = 0 To 1
        lblData(i).BackColor = vbWhite
        picData(i).Picture = LoadResPicture("cal1", 0)
    Next i
    
    cboTipoUtente.ListIndex = 4
End Sub

'' Verifica prima di mandare in stampa se i dati sono corretti
Private Function Completo() As Boolean
    Completo = False
    If lblData(0) <> strTutte Then
        If lblData(1) <> strTutte Then
            If CDate(lblData(0)) > CDate(lblData(1)) Then
                MsgBox "Inserire le date correttamente", vbCritical, "Attenzione"
                Exit Function
            End If
        Else
            MsgBox "Inserire entrambe le date", vbCritical, "Attenzione"
            Exit Function
        End If
    Else
        If lblData(1) <> strTutte Then
            MsgBox "Inserire entrambe le date", vbCritical, "Attenzione"
            Exit Function
        End If
    End If
    Completo = True
End Function

Private Sub cmdAnnulla_Click()
    Unload Me
End Sub

Private Sub lblData_Click(Index As Integer)
    laData = ""
    lblData(0) = strTutte
    lblData(1) = strTutte
End Sub

Private Sub picData_Click(Index As Integer)
    frmCalendario.Show 1
    If laData <> "" Then lblData(Index) = laData
End Sub

Private Sub picData_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    picData(Index).Picture = LoadResPicture("cal2", 0)
End Sub

Private Sub picData_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
    picData(Index).Picture = LoadResPicture("cal1", 0)
End Sub
